<!-- php:$comment = phpok('_comment','tid='.$tid,'psize=10','orderby=desc','sublist=2') -->
<div class="card">
	<div class="card-header">
		<div class="d-flex justify-content-between">
			<div>提交新评论<!-- if $comment.total --> <b>（{$comment.total}）</b> <!-- /if --></div>
			<!-- if $comment.total -->
			<div>
				<a target="_blank" href="{url ctrl=content func=comment id=$rs.id/}" class="btn btn-primary btn-sm">全部评论</a>
			</div>
			<!-- /if -->
		</div>
	</div>
	<div class="card-body">
		<form method="post" id="comment-post">
			<input type="hidden" name="tid" value="{$tid ? $tid : $rs.id}" />
			<input type="hidden" name="vtype" value="{$vtype ? $vtype : 'title'}" />
			<!-- if $comment.uid -->
			<div class="form-group">{func form_edit comment $comment.content editor width=100%&height=150&btns[image]=1}</div>
			<!-- else -->
			<div class="form-group">
				<textarea class="form-control" rows="5" name="comment" id="comment" placeholder="填写评论信息" style="resize: none;"></textarea>
			</div>
			<!-- /if -->
			<!-- if $is_vcode -->
			<div class="form-group mt-2">
				<div class="row">
					<div class="col-sm-3"><input class="form-control"  type="text" name="_chkcode" id="_chkcode" placeholder="请填写验证码" /></div>
					<div class="col-sm-2"><img src="" border="0" align="absmiddle" id="vcode" class="hand" /></div>
				</div>
			</div>
			<script type="text/javascript">
			$(document).ready(function(){
				$("#vcode").phpok_vcode();
				$("#vcode").click(function(){
					$(this).phpok_vcode();
				});
			});
			</script>
			<!-- /if -->
			<div class="form-group d-block mt-4">
				<input name="" type="submit" class="btn btn-primary" value="提交" />
			</div>
		</form>
	</div>
</div>
<!-- loop from=$comment.rslist key=$key value=$value id=tmpid -->
<div class="card mt-2">
	<div class="card-header pt-1 pb-1">
		<div class="d-flex justify-content-between">
			<div>
				<div class="row row-cols-auto">
					<div class="col">
						<a href="{url ctrl=user id=$value.uid/}" target="_blank"><img src="{$value.avatar}" class="avatar" alt="{$value.user}" /></a>
					</div>
					<div class="col">
						<a href="{url ctrl=user id=$value.uid/}" target="_blank">{$value.user}</a><br />
						<time>{func time_format $value.addtime}</time>
					</div>
				</div>
			</div>
			<!-- if $value.click_list -->
			<div>
				<div class="row row-cols-auto">
					<!-- loop from=$value.click_list key=$k value=$v id=$idxx -->
					<div class="col text-nowrap" title="{$v.title}">
						<div class="hand" onclick="$.comment.click({$value.id},'{$k}','reply')">
							<img id="{$k}-{$value.id}-img" src="{$v.is_clicked ? $v.icon1 : $v.icon2}" class="width_16" /> {$v.title} <small id="{$k}-{$value.id}-total">({$v.total})</small>
						</div>
						<!-- if $v.wholist -->
						<div class="row">
							<!-- loop from=$v.wholist key=$kk value=$vv id=$idxxx -->
							<div class="col">
								<a href="{url ctrl=content func=wholist id=$tid tid=$value.id uid=$vv.id/}" target="_blank"><img src="{$vv.avatar}" class="avatar-small" alt="{$vv.user}" /></a>
							</div>
							<!-- /loop -->
						</div>
						<!-- /if -->
					</div>
					<!-- /loop -->
				</div>
			</div>
			<!-- /if -->
		</div>
	</div>
	<div class="card-body">
		<p class="card-text"><!-- if $value.vouch --><span class="badge badge-danger mr-2">佳</span><!-- /if -->{$value.content}</p>
		<!-- if $value.res -->
		<div class="row row-cols-1 row-cols-sm-2 row-cols-md-4">
			<!-- loop from=$value.res key=$k value=$v id=$idxx -->
			<div class="col p-2"><a href="{$v.gd.auto}" target="_blank"><img src="{$v.gd.thumb}" alt="{$v.title}" class="rounded" style="max-width:100%" /></a></div>
			<!-- /loop -->
		</div>
		<!-- /if -->
		<!-- loop from=$value.adm_reply key=$k value=$v id=$idxx -->
		<fieldset class="admin-reply">
			<legend>管理员回复</legend>
			<div class="content">
				<div class="float-right" style="margin-top:-1.6em;"><small><time>{func time_format $v.addtime}</time></small></div>
				{$v.content}
			</div>
		</fieldset>
		<!-- /loop -->
		<!-- loop from=$value.sublist key=$k value=$v id=$idx -->
		<div class="card mt-2">
			<div class="card-header pt-1 pb-1">
				<div class="d-flex justify-content-between">
					<div>
						<div class="row row-cols-auto">
							<div class="col">
								<a href="{url ctrl=user id=$v.uid/}" target="_blank"><img src="{$v.avatar}" class="avatar" alt="{$v.user}" /></a>
							</div>
							<div class="col">
								<a href="{url ctrl=user id=$v.uid/}" target="_blank">{$v.user}</a><br />
								<time>{func time_format $v.addtime}</time>
							</div>
						</div>
					</div>
					<!-- if $v.click_list -->
					<div>
						<div class="row row-cols-auto">
							<!-- loop from=$v.click_list key=$kk value=$vv id=$idxx -->
							<div class="col text-nowrap ">
								<div class="hand" onclick="$.comment.click({$v.id},'{$kk}','reply')"><img id="{$kk}-{$v.id}-img" src="{$vv.is_clicked ? $vv.icon1 : $vv.icon2}" style="width:16px;height:16px;" /> {$vv.title} <small id="{$kk}-{$v.id}-total">({$vv.total})</small></div>
								<!-- if $vv.wholist -->
								<div class="row">
									<!-- loop from=$vv.wholist key=$kkk value=$vvv id=$idxxx -->
									<div class="col">
										<a href="{url ctrl=content func=wholist id=$tid tid=$v.id uid=$vvv.id/}" target="_blank"><img src="{$vvv.avatar}" class="avatar-small" alt="{$vv.user}" /></a>
									</div>
									<!-- /loop -->
								</div>
								<!-- /if -->
							</div>
							<!-- /loop -->
						</div>
					</div>
					<!-- /if -->
				</div>
			</div>
			<div class="card-body">
				<p class="card-text">{$v.content}</p>
				<!-- loop from=$v.adm_reply key=$kk value=$vv id=$idxx -->
				<fieldset class="admin-reply">
					<legend>管理员回复</legend>
					<div class="content">
						<div class="float-right" style="margin-top:-1.6em;"><small><time>{func time_format $vv.addtime}</time></small></div>
						{$vv.content}
					</div>
				</fieldset>
				<!-- /loop -->
			</div>
		</div>
		<!-- /loop -->
		<div class="d-flex justify-content-between mt-2">
			<div>
				<button onclick="$.phpok.open('{url ctrl=content func=comment id=$rs.id parent_id=$value.id/}')" class="btn btn-warning btn-sm">
					<span class="badge badge-light">{$value.reply_total}</span> 条回复
					<i class="fa fa-angle-right"></i>
				</button>
			</div>
			<div>
				<button type="button" class="btn btn-primary btn-sm" onclick="$.comment.reply('{$value.id}','{$tid ? $tid : $rs.id}','{$is_vcode ? 1 : 0}')">点评回复</button>
			</div>
		</div>
	</div>
</div>
<!-- /loop -->
<section class="container">
	<div class="m-4"><!-- include tpl=block/pagelist pageurl=$rs.url total=$comment.total pageid=$comment.pageid psize=$comment.psize --></div>
</section>